package com.atguigu.f_bigdecimal;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Demo1 {
    public static void main(String[] args) {
        BigDecimal bd1 = new BigDecimal("0.1");//
        BigDecimal bd2 = new BigDecimal("0.8");//

        System.out.println("bd1.divide(bd2) = " + bd1.divide(bd2));//0.125

        //向上取整
        System.out.println(bd1.divide(bd2, 2, RoundingMode.UP));
        System.out.println(bd1.divide(bd2, 2, RoundingMode.CEILING));

        //向下取整
        System.out.println(bd1.divide(bd2, 2, RoundingMode.DOWN));
        System.out.println(bd1.divide(bd2, 2, RoundingMode.FLOOR));

        //四舍五入
        System.out.println(bd1.divide(bd2, 2, RoundingMode.HALF_UP));


    }
}
